﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace HRSWeb.Presentation.Login
{
    public class AuthenticatedUser
    {
        private const string USER_SESSION_KEY = "C380EE69-1187-41DE-BFE7-534FC9566FC9";

        private static AuthenticatedUser _current;
        public static AuthenticatedUser Current
        {
            get
            {
                if (_current == null)
                    _current = new AuthenticatedUser();
                return _current;
            }
        }

        public HrsServiceProxy.AuthenticatedUserDTO User
        {
            get
            {
                return HttpContext.Current.Session[USER_SESSION_KEY] as HrsServiceProxy.AuthenticatedUserDTO;
            }
            set
            {
                HttpContext.Current.Session[USER_SESSION_KEY] = value;
            }
        }

        internal void Remove()
        {
            User = null;
        }
    }
}